<template>
  <div>
    <el-card
      class="!border-none relative el-card-client"
      v-loading="pager.loading"
      shadow="never"
    >
      <template #header>
        <el-row :gutter="10">
          <el-col :span="6">
            <el-input
              class="input_style"
              v-model="queryParams.keywords"
              clearable
              placeholder="请输入搜索关键字"
            />
          </el-col>
          <el-col :span="16">
            <el-button
              type="primary btn_style"
              @click="getLists"
              color="#63ccba"
              class="mr_5"
            >
              <template #icon>
                <el-icon color="#fff">
                  <Search />
                </el-icon> </template
              >搜索
            </el-button>
            <el-button @click="resetParams" class="mr_5">重置</el-button>
          </el-col>
          <!-- <el-col :span="2" class="flex justify-end">
            <move-button></move-button>
          </el-col> -->
        </el-row>
      </template>
      <div style="padding-bottom: 2rem">
        <el-table
          :data="pager.lists"
          border
          v-loading="pager.loading"
          stripe
          max-height="calc(100vh - 16rem)"
        >
          <el-table-column label="昵称" prop="name" align="center" />
          <el-table-column label="用户" prop="account" align="center" />
          <el-table-column label="用户ID" prop="id" align="center" />
          <el-table-column label="总收入" align="center">
            <template #default="{ row }">
              <span class="red">{{ row.totalMoney }}</span>
            </template>
          </el-table-column>
          <el-table-column label="月收入" align="center">
            <template #default="{ row }">
              <span class="red">{{ row.monthMoney }}</span>
            </template>
          </el-table-column>
          <el-table-column label="今日收入" align="center">
            <template #default="{ row }">
              <span class="red">{{ row.toDayMoney }}</span>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="pd_t_b position">
        <pagination v-model="pager" @change="getLists" />
      </div>
    </el-card>
    <edit-popup
      v-if="showEdit"
      ref="editRef"
      :dict-data="dictData"
      @success="getLists"
      @close="showEdit = false"
    />
  </div>
</template>

<script lang="ts" setup name="zgStatisticsLists">
import { TwentyUsePaging } from "@/hooks/usePaging";
import { useDictData } from "@/hooks/useDictOptions";
import {
  apiZgStatisticsLists,
  apiZgStatisticsDelete,
} from "@/api/zg_statistics";
import { timeFormat } from "@/utils/util";
import feedback from "@/utils/feedback";
import EditPopup from "./edit.vue";
import moveButton from "@/components/moveButton/index.vue";

// 查询条件
const queryParams = reactive({
  keywords: "",
});

// 分页相关
const { pager, getLists, resetParams, resetPage } = TwentyUsePaging({
  fetchFun: apiZgStatisticsLists,
  params: queryParams,
});

getLists();
</script>
